package com.jt;

import com.jt.Service.DeptService;
import com.jt.Service.SpringConfig;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.swing.*;
import java.applet.AppletContext;

public class test {
    @Test
    public void test01(){
        ApplicationContext context=
                 new AnnotationConfigApplicationContext(SpringConfig.class);
        DeptService deptService = context.getBean(DeptService.class);
        deptService.addDept();
        deptService.updateDept();

    }

    @Test
    public void test02(){
        ApplicationContext context=
                new AnnotationConfigApplicationContext(SpringConfig.class);
        DeptService deptService = context.getBean(DeptService.class);
        String result = deptService.after(110);
        System.out.println("test方法接收返回值"+result);
    }
    @Test
    public void test03() {
        ApplicationContext context =
                new AnnotationConfigApplicationContext(SpringConfig.class);
        DeptService deptService = context.getBean(DeptService.class);
        deptService.afterThrow();
    }

    //测试环绕通知
    @Test
    public void test04() {
        ApplicationContext context =
                new AnnotationConfigApplicationContext(SpringConfig.class);
        DeptService deptService = context.getBean(DeptService.class);
        deptService.doAround();
    }

    //测试环绕通知
    @Test
    public void test05() {
        ApplicationContext context =
                new AnnotationConfigApplicationContext(SpringConfig.class);
        DeptService deptService = context.getBean(DeptService.class);
        deptService.doOrder();
    }
}
